﻿@model List<PhoneBilling.UIUnkown>
@{
    ViewBag.Title = "不明话单管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">
    function modify(date,caller,id) {
        var url = '@Url.Content("~/System/UnkownEdit?endTime=")' + date + "&caller=" + caller + "&id=" + id;
        var targetDiv = "#unkownEdit"
        $.get(url, null, function (result) {
            $(targetDiv).html(result);
        });
    }
    function delete1(date, caller, id) {
        var url = '@Url.Content("~/System/UnkownDelete?endTime=")' + date + "&caller=" + caller + "&id=" + id;
        var targetDiv = "#unkownEdit"
        $.get(url, null, function (result) {
            $(targetDiv).html(result);
            if(result.substr(6,4) == "操作成功");
            {
                $("#" + id).hide();
            }
        });
    }
</script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#btnPatchDelete").ligerButton(
        {
            click: function () {
                window.location.href = "/Manage/UnkownPatchDelete";
            }
        });
    });
</script>
<div id="unkownEdit"></div>
<div class="system_toolbar">
    <input type="button" id="btnModify" value="修改" />
    <input type="button" id="btnDelete" value="删除" />
    <input type="button" id="btnPatchDelete" value="批量删除" />
</div>    
<div id="unkownList">

@{
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.AppendLine(string.Format("var data={{Total:{0},",Model.Count));
    sb.AppendLine("Rows:[");
    for(int i =0;i < Model.Count;i++)
    {
        var item = Model[i];
        if(i == 0)
        {
            sb.Append("{");
        }
        else
        {
            sb.Append(",{");
        }
        sb.Append(string.Format("ID:'{0}',", item.ID));
        sb.Append(string.Format("挂机时间:'{0}',", item.挂机时间));
        sb.Append(string.Format("主叫分机:'{0}',", item.主叫分机));
        sb.Append(string.Format("拨出号码:'{0}',", item.拨出号码));
        sb.Append(string.Format("拨叫地区:'{0}',", item.拨叫地区));
        sb.Append(string.Format("话类:'{0}',", item.话类));
        sb.Append(string.Format("通话时长:'{0}',", item.通话时长));
        sb.Append(string.Format("标志:'{0}',", item.标志));
        sb.Append(string.Format("交换机号:'{0}'", item.交换机号));
        sb.Append("}");
    }
    sb.AppendLine("]};");
    string data = sb.ToString();
}
<script type="text/javascript">
    @Html.Raw(data)
    
    var menu = $.ligerMenu({ top: 100, left: 100, width: 120, items:
            [
            { text: '修改', click: modifyclick },
            { line: true },
            { text: '删除', click: deleteclick }
            ]
        });
    var grid;
    $(function () {

        grid = $("#maingrid").ligerGrid({
            columns: [
                { display: '挂机时间', name: '挂机时间',width:80},
                { display: '主叫分机', name: '主叫分机',width:80},
                { display: '拨出号码', name: '拨出号码',width:80},
                { display: '拨叫地区', name: '拨叫地区',width:80},
                { display: '话类', name: '话类',width:80},
                { display: '通话时长', name: '通话时长',width:80},
                { display: '挂机时间', name: '挂机时间',width:80},
                { display: '标志', name: '标志',width:80},
                { display: '交换机号', name: '交换机号',width:80}],
                isScroll: false, data: data,pageSize:30,alternatingRow:true,  
                onContextmenu: function (node, e) {
            actionNodeID = node;
            menu.show({ top: e.pageY, left: e.pageX });
            return false;
        }
        }
        );resetGridHeight(grid);
        $(window).resize(function () {
                resetGridHeight(grid);
            });
    });    function newclick(item, i) {
        var path = "/Manage/UserEdit";
        window.location.href=path;
    }
    function modifyclick(item, i) {
        var path = "/Manage/UserEdit?id="+actionNodeID.data.ID;
        window.location.href=path;
    }    function deleteclick(item, i) {
        del(actionNodeID.data.Name,actionNodeID.data.ID);
    }
    $(document).ready(function () {
        $("#btnModify").ligerButton(
        {
            click: function () {
                var row = grid.getSelectedRow();
                if(row != null)
                {
                    modify(row.挂机时间,row.主叫分机,row.ID);
                }
            }
        });

        $("#btnDelete").ligerButton(
        {
            click: function () {
                var row = grid.getSelectedRow();
                if(row != null)
                {
                    delete1(row.挂机时间,row.主叫分机,row.ID);
                }
            }
        });
    });
</script>

 <div id="maingrid"></div>
@*
<table>
    <tr>
        <th>挂机时间</th>
        <th>主叫分机</th>
        <th>拨出号码</th>
        <th>拨叫地区</th>
        <th>话类</th>
        <th>通话时长</th>
        <th>标志</th>
        <th>交换机号</th>
        <th></th>
        <th></th>
    </tr>
    @{
        foreach (var detail in Model)
        {
        <tr id="@detail.ID">
            <td>@detail.挂机时间</td>
            <td>@detail.主叫分机</td>
            <td>@detail.拨出号码</td>
            <td>@detail.拨叫地区</td>
            <td>@detail.话类</td>
            <td>@detail.通话时长</td>
            <td>@detail.标志</td>
            <td>@detail.交换机号</td>
            <td><input type="button" value="修改" class="input-submit-02" onclick="modify('@detail.挂机时间','@detail.主叫分机','@detail.ID')" /></td>
            <td><input type="button" value="删除" class="input-submit-02" onclick="delete1('@detail.挂机时间','@detail.主叫分机','@detail.ID')" /></td>
        </tr>
        }
    }
</table>
</div>
*@

